<?php

////////////////////////////////////////////////////////////////////////////////////////
//
// Returns TRUE if the user trusts the site, FALSE otherwise.
//
////////////////////////////////////////////////////////////////////////////////////////
function IGBRequireTrust() {

		
		if (! IGBDetect()) {
			header ( 'eve.trustMe:http://' . $_SERVER ['HTTP_HOST'] . '/::This site needs trust to function.' );
			return false;
		}
	
	return true;
}

////////////////////////////////////////////////////////////////////////////////////////
//
// Returns TRUE if the browser is the EVE mini-browser, FALSE otherwise.
//
////////////////////////////////////////////////////////////////////////////////////////
function IGBDetect() {
	if ($_SERVER ['HTTP_USER_AGENT'] == "EVE-IGB" || $_SERVER ['HTTP_USER_AGENT'] == "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/531.3 (KHTML, like Gecko) Chrome/1, 5, 0, 102 Safari/531.3; EVE-IGB") {
		return true;
	}
	if ($_SERVER ['HTTP_USER_AGENT'] != "EVE-IGB") {
		return isset ( $_SERVER ['HTTP_EVE_TRUSTED'] );
	}
	
}

//---------------------------------------------------------------------------//
// Returns True if character is a director                                   //
//---------------------------------------------------------------------------//
function isDirector() {
	$roles = ( float ) $_SERVER ['HTTP_EVE_CORPROLE'];
	if (($roles & 1) || $roles == 72057594037927809) {
		return true;
	} else {
		return false;
	}

} //end fucntion


//---------------------------------------------------------------------------//
// Returns True if character is a personell manager                          //
//---------------------------------------------------------------------------//
function isPersonnelMgr() {
	$roles = ( float ) $_SERVER ['HTTP_EVE_CORPROLE'];
	if ($roles & (128)) {
		return true;
	} else {
		return false;
	}

} //end fucntion


//---------------------------------------------------------------------------//
// Returns True if character is a accountant                                 //
//---------------------------------------------------------------------------//
function isAccountant() {
	$roles = ( float ) $_SERVER ['HTTP_EVE_CORPROLE'];
	if ($roles & (256)) {
		return true;
	} else {
		return false;
	}

} //end function


//---------------------------------------------------------------------------//
// Returns True if character is a Security Manager
//---------------------------------------------------------------------------//
function isSecurityMgr() {
	$roles = ( float ) $_SERVER ['HTTP_EVE_CORPROLE'];
	if ($roles & (512)) {
		return true;
	} else {
		return false;
	}

} //end function


//---------------------------------------------------------------------------//
// Returns True if character is a Factory Manager
//---------------------------------------------------------------------------//
function isFactoryMgr() {
	$roles = ( float ) $_SERVER ['HTTP_EVE_CORPROLE'];
	if ($roles & (1024)) {
		return true;
	} else {
		return false;
	}

} //end function


//---------------------------------------------------------------------------//
// Returns True if character is a Station Manager
//---------------------------------------------------------------------------//
function isStationMgr() {
	$roles = ( float ) $_SERVER ['HTTP_EVE_CORPROLE'];
	if ($roles & (2048)) {
		return true;
	} else {
		return false;
	}

} //end function


//--------------------------------------------------------//
// Returns Characters Name
//--------------------------------------------------------//


function getName() {
	return $_SERVER ['HTTP_EVE_CHARNAME'];
}

//-----------------------
// Returns Character ID
//-----------------------


function getCharId() {
	$_SERVER ['HTTP_EVE_CHARID'];
}

//--------------------------------------------------------//
// Returns Corp Name
//--------------------------------------------------------//


function getCorpName() {
	return $_SERVER ['HTTP_EVE_CORPNAME'];
}

//--------------------------------------------------------//
// Returns Corp id
//--------------------------------------------------------//


function getCorpId() {
	return $_SERVER ['HTTP_EVE_CORPID'];
}

?>
